<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <button @click="list[0].name = '张张'">修改下标0</button>
      <ul>
        <li v-for="item in list">{{ item.name }}</li>
      </ul>
    </div>
    <script src="./vue.js"></script>
    <script>
      new Vue({
        el: '#app',
        data () {
          return {
            list: [
              {
                id: 1,
                name: '张三'
              },
              {
                id: 2,
                name: '李四'
              },
              {
                id: 3,
                name: '王五'
              }
            ]
          }
        },
        watch: {
          //   list () {
          //     console.log('改变了')
          //   }

          list: {
            deep: true,
            handler () {
              console.log('改变了')
            }
          }
        }
      })
    </script>
  </body>
</html>
